<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Access-Control-Allow-Origin" charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- Favicon -->
    <link rel="shortcut icon" href="assets/media/image/favicon.png" />

    <!-- Plugin styles -->
    <link rel="stylesheet" href="vendors/bundle.css" type="text/css">

    <!-- Prism -->
    <link rel="stylesheet" href="vendors/prism/prism.css" type="text/css">

    <!-- App styles -->
    <link rel="stylesheet" href="assets/css/app.css" type="text/css">

</head>

<body>
<div th:if="${error} ne null" th:text="${error}" class="alert alert-warning" role="alert"></div>

    <form action="/toDeclaration" method="post">
        <input name="unitName" id="unitName" type="text" placeholder="请输入职改办名称">
        <button type="submit" id="submit">确定</button>
    </form>

    <script src="js/node_modules/jquery/dist/jquery.js"></script>
    <!-- Plugin scripts -->
    <script src="vendors/bundle.js"></script>
    <!-- Prism -->
    <script src="vendors/prism/prism.js"></script>
    <!-- App scripts -->
    <script src="assets/js/app.js"></script>



    <script>
        /*
        //只能绑定，但不能绑定数据
        var $unitName = $("#unitName");

        $(function () {

            $("#apply1").click(function () {

                alert("Click");
                $.post("http://localhost:8081/findUnit", function (res) {
                    alert(res[0].unitName);
                    for (var i = 0; i < res.length; i++) {
                        if ($unitName.val() == res[i].unitName) {
                            alert("true");
                        } else {
                            alert("false");
                        }
                    }

                });

            });

            $("#apply2").click(function () {

                alert("Click" + $unitName.val());
                $.post("http://localhost:8081/findOneUnit", {unitName:$unitName.val()}, function (res) {
                    alert(res.unitName);
                    if(res.unitName == $unitName.val()) {
                        alert("true");
                        location.href ="./index.html";
                    }else {
                        alert("false");
                    }

                });

            });

        });
*/

    </script>
</body>

</html>
